<!--重点排查-->
<template>
  <div id="surveillance">
    <div class="surveillance-nfcc">
      <div style="margin-top: 10px">
        <van-search
          v-model="value"
          style="border-radius: 10px; height: 44px"
          background="#f7f8fa"
          placeholder="请输入搜索关键词"
          @search="serachData"
        />
      </div>
      <div class="surveillance-middle1" v-show="ListData.length > 0" ref="surveillanceMiddle1">
        <ul v-for="(item, index) in ListData" :key="index" @click="handleAdd(item)" class="surveillance-middle">
          <li class="surveillance-middle2">
            户主姓名：{{ item.CQRMZ }}
            <span v-if="item.XZYJ == 3" style="float: right; color: red"><van-icon name="flag-o" /></span>
            <span v-if="item.XZYJ == 2" style="float: right; color: orange"><van-icon name="flag-o" /></span>
            <span v-if="item.XZYJ == 1" style="float: right; color: green"><van-icon name="flag-o" /></span>
            <span style="float: right;">{{item.DQZT == '626' ? '未推送' :item.DQZT == '627' ? '网格员巡查中' :item.DQZT == '628' ? '镇街审核' :item.DQZT == '629' ? '危改未申请' :item.DQZT == '630' ? '危改已申请' :item.DQZT == '631' ? '危房鉴定' :item.DQZT == '632' ? '危房整治' :item.DQZT == '633' ? '复核鉴定' :item.DQZT == '634' ? '归档' :item.DQZT == '638' ? '待巡查' :item.DQZT == '639' ? '未处理' :item.DQZT == '640' ? '已发送镇街排查' :item.DQZT == '641' ? '待排查' :item.DQZT == '642' ? '督促' :item.DQZT == '643' ? '已纳入房屋治理' :"备案"}}</span>
          </li>
          <li class="surveillance-middle3">
            发送时间：{{ item.TASK_RECIEVEDATE }}
            <span
              >初判结论：{{
                item.CBJD == '372' ? '房屋基本安全' :  '存在风险'
              }}</span
            >
          </li>
          <li class="surveillance-middle4">
            具体用途：{{ item.FWYT == 606?'经营性自建房':"其他自建房" }}
            <span style="width: 190px;overflow:hidden;text-overflow:ellipsis;text-align: right;">排查结论:{{ item.CBPD==1?"基本安全(甲类、乙类)":'存在安全隐患(丙类、需要安全鉴定)' }}</span>
          </li>
        </ul>
      </div>
      <div v-show="ListData.length == 0" style="height: 84vh; text-align: center; padding-top: 20vh">
        <div style="margin-bottom: 10px">
          <img src="https://nfzjszlb.jst.zj.gov.cn/serverfile/zheliban/icon/DSF/50.png" />
        </div>
        <div>暂无数据</div>
      </div>
      <div class="surveillance-footer" v-show="ISShow">
        <van-button color="dodgerblue" block @click="handleAdd">新增</van-button>
      </div>
    </div>
  </div>
</template>
<script>
import dd from 'gdt-jsapi'
import {
  QuerySignCallback,
} from '@/utils/api'
export default {
  data() {
    return {
      active: '0',
      value: '',
      ISShow: true,
      cityCode: '',
      ListData: [
        {
          FWYT: '0',
          CBPD: '0',
          CBJD: '0',
          XZYJ:"",
          TASK_RECIEVEDATE: Date.now(),
          CQRMZ: '1233',
        }
      ],
      deepListData:[

      ]
    }
  },
  methods: {
    handleAdd(data) {
      this.$router.push({
        path: '/farmhouseInspector',
        query: {
          data: JSON.stringify(data),
        },
      })
    },
    serachData(val) {
      if(!val) return this.ListData = this.deepListData
      this.ListData =  this.ListData.filter(item=>{
        return item.CQRMZ&&item.CQRMZ.indexOf(val)
      })
    },
    getData: async function () {
      let accessCode = '688bd3883572440a859dfd8ba9194e7b'
      let params = {
        accessCode: accessCode,
        cityCode: window.localStorage.getItem('citycode') ? window.localStorage.getItem('citycode') : '441300000000',
        params: {
          dataguid: '26ee90e4-90fd-4b2f-abc2-068e9ef008e9',
          strParams: [],
        },
      }
      const res = await QuerySignCallback(params)
      this.ListData = JSON.parse(res.data.data).Data
      this.deepListData = this.ListData
      console.log(this.ListData,'hhh')
    },
  },
  created(){
  },
  mounted() {
    this.getData()
    dd.ready(function () {
      dd.setTitle({
        title: '新增巡查',
      })
        .then((res) => {})
        .catch((err) => {
          console.error(err)
        })
    })
  },
}
</script>
<style lang="scss" scoped >
#surveillance {
  height: 100vh;
  overflow: auto;
  background: #eee;
  width: 100vw;
  font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif;
  font-size: 18px;
  padding: 6px 10px;
  .title {
    width: 100%;
    height: 46px;
    background: #007aff;
    line-height: 50px;
    text-align: center;
    color: #ffffff;
    font-size: 20px;
  }
  .surveillance-footer {
    width: 99%;
    margin-top: 4px;
    margin: 0 auto;
    padding-top: 12px;
  }
  .surveillance-middle1 {
    height: 84vh;
    overflow: auto;
    .surveillance-middle {
      background-color: #fff;
      border-radius: 10px;
      padding: 8px 10px;
      width: 98%;
      height: 130px;
      margin: 0 auto;
      margin-top: 14px;
      .surveillance-middle2 {
        font-size: 18px;
        font-weight: 1000;
        color: black;
        line-height: 36px;
      }
      .surveillance-middle3 {
        font-size: 14px;
        color: #aaa;
        line-height: 24px;
        span {
          float: right;
          // padding-left: 4vw;
        }
      }
      .surveillance-middle4 {
        font-size: 14px;
        color: #aaa;
        line-height: 24px;
        span {
          float: right;
          // padding-left: 4vw;
        }
      }
    }
  }
}
</style>
<style>
#surveillance .van-tab {
  font-size: 18px;
}
</style>
